  // 创建鼠标hover提示指令
  const introduceHint = {
    mounted(el, binding) {
        // 获取绑定的值作为Tooltip的内容
        const tooltipContent = binding.value;
    
        // 创建Tooltip元素
        const tooltip = document.createElement('div');
        tooltip.className = 'tooltip';
        // tooltip.textContent = tooltipContent;
        tooltip.innerHTML = tooltipContent;
        document.body.appendChild(tooltip);
    
        // 显示/隐藏Tooltip的函数
        function showTooltip() {
          const rect = el.getBoundingClientRect();
          //获取屏幕的innerWidth和innerHeight
          const { innerWidth, innerHeight } = window;
          tooltip.style.maxWidth = '300px';
          tooltip.style.minWidth = '300px';
          tooltip.style.left = `${rect.right + 10}px`;
          tooltip.style.top = `${rect.top + 0}px`;
          if (rect.right + tooltip.offsetWidth > innerWidth-50) {
            tooltip.style.left = `${rect.left - tooltip.offsetWidth}px`;
          }
          if (rect.bottom + tooltip.offsetHeight > innerHeight-50) {
            tooltip.style.top = `${rect.top - tooltip.offsetHeight}px`;
          }

          tooltip.style.display = 'block';
          tooltip.style.zIndex = 9999;
          tooltip.style.position = 'absolute';
          tooltip.style.backgroundColor = '#fff';
          tooltip.style.color = '#000';

          tooltip.style.padding = '10px';
          tooltip.style.wordBreak = "break-all"
          tooltip.style.borderRadius = '10px';
          tooltip.style.boxShadow = '0 0 20px rgba(134,156,178,0.8)';
          tooltip.style.border = '1px solid #ccc';
          // console.log(142,'showTooltip');
        }
    
        function hideTooltip() {
          tooltip.style.display = 'none';
        }
    
        // 添加事件监听器
        el.addEventListener('mouseenter', showTooltip);
        el.addEventListener('mouseleave', hideTooltip);
    
        // 清理函数，用于在指令卸载时移除事件监听器
        return () => {
          el.removeEventListener('mouseenter', showTooltip);
          el.removeEventListener('mouseleave', hideTooltip);
          document.body.removeChild(tooltip);
        };
      },
  };
  export default introduceHint